package com.tang.lts.core.nio.channel;

import com.tang.lts.core.nio.codec.Decoder;
import com.tang.lts.core.nio.codec.Encoder;
import com.tang.lts.core.nio.handler.Futures;

import java.net.SocketAddress;
import java.nio.channels.SocketChannel;

/**
 * @author Tang
 * @classname NioChannel
 * @description [ 包装 socket ]
 * @date 2022/5/12 23:02
 */
public interface NioChannel {

    long getId();

    SocketAddress remoteAddress();

    SocketAddress localAddress();

    boolean isConnected();

    boolean isOpen();

    boolean isClosed();

    SocketChannel socketChannel();

    Futures.WriteFuture writeFlush(Object msg);

    void setLastReadTime(long lastReadTime);

    void setLastWriteTime(long lastWriteTime);

    Futures.CloseFuture close();

    public Encoder getEncoder();

    public Decoder getDecoder();
}